#include "comm.h"

int main()
{
    int fd = open(MY_FIFO, O_WRONLY);
    if(fd < 0)
    {
        printf("open failed\n");
        exit(1);
    }
    //const char* str = "i am process A";
    
    while(1)
    {
	char buf[1024];
	ssize_t s = read(0, buf, sizeof(buf)-1);
	if(s > 0)
	{
	     buf[s-1] = 0;
             printf("%s\n", buf);	     
	     write(fd, buf, strlen(buf));
	}
    }

    return 0;
}
